import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '规则名称',
    align:"center",
    dataIndex: 'ruleName'
   },
   {
    title: '早上上课最早打卡时间',
    align:"center",
    dataIndex: 'morningAttlassEarliestTime'
   },
   {
    title: '早上上课最晚打卡时间',
    align:"center",
    dataIndex: 'morningAttlassLatestTime'
   },
   {
    title: '中午归寝最早时间',
    align:"center",
    dataIndex: 'noonInEarliestTime'
   },
   {
    title: '中午最晚归寝时间',
    align:"center",
    dataIndex: 'noonInLatestTime'
   },
   {
    title: '下午上课最早打卡时间',
    align:"center",
    dataIndex: 'afternootAttclassEarliestTime'
   },
   {
    title: '下午上课最晚打卡时间',
    align:"center",
    dataIndex: 'afternootAttclassLatestTime'
   },
   {
    title: '下午归寝最早时间',
    align:"center",
    dataIndex: 'nightInEarliestTime'
   },
   {
    title: '下午离寝最晚时间',
    align:"center",
    dataIndex: 'nightInLatestTime'
   },
   {
    title: '晚上最早归寝时间',
    align:"center",
    dataIndex: 'nightEarliestTime'
   },
   {
    title: '晚上最晚归寝时间',
    align:"center",
    dataIndex: 'nightTime'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "规则名称",
      field: 'ruleName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "状态",
      field: 'status',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"userAble"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '规则名称',
    field: 'ruleName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入规则名称!'},
          ];
     },
  },
  {
    label: '分组',
    field: 'groupIds',
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"ac_group,group_name,id"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择分组!'},
          ];
     },
  },
  
  {
    label: '早上上课最早打卡时间',
    field: 'morningAttlassEarliestTime',
	component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '早上上课最晚打卡时间',
    field: 'morningAttlassLatestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '中午归寝最早时间',
    field: 'noonInEarliestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '中午最晚归寝时间',
    field: 'noonInLatestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '下午上课最早打卡时间',
    field: 'afternootAttclassEarliestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '下午上课最晚打卡时间',
    field: 'afternootAttclassLatestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '下午归寝最早时间',
    field: 'nightInEarliestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '下午离寝最晚时间',
    field: 'nightInLatestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '晚上最早归寝时间',
    field: 'nightEarliestTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '晚上最晚归寝时间',
    field: 'nightTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm'
    },
  },
  {
    label: '状态',
    field: 'status',
    defaultValue: "1",
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"userAble",
		    disabled:true
     },
	  show: false

  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  ruleName: {title: '规则名称',order: 0,view: 'text', type: 'string',},
  ruleName: {title: '规则名称',order: 1,view: 'text', type: 'string',},
  morningAttlassEarliestTime: {title: '早上上课最早打卡时间',order: 10,view: 'text', type: 'string',},
  morningAttlassLatestTime: {title: '早上上课最晚打卡时间',order: 11,view: 'text', type: 'string',},
  noonInEarliestTime: {title: '中午归寝最早时间',order: 2,view: 'text', type: 'string',},
  noonInLatestTime: {title: '中午最晚归寝时间',order: 3,view: 'text', type: 'string',},
  afternootAttclassEarliestTime: {title: '下午上课最早开始时间',order: 4,view: 'text', type: 'string',},
  afternootAttclassLatestTime: {title: '下午午最晚归寝时间',order: 5,view: 'text', type: 'string',},
  nightInEarliestTime: {title: '晚上归寝最早时间',order: 6,view: 'text', type: 'string',},
  nightInLatestTime: {title: '晚上最晚归寝时间',order: 7,view: 'text', type: 'string',},
  nightTime: {title: '晚上最晚归寝时间',order: 8,view: 'text', type: 'string',},
  status: {title: '状态',order: 9,view: 'radio', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}